<template>
  <div class="auth-layout">
    <!-- Header -->
    <AppHeader />

    <!-- Main Content -->
    <main class="main-content">
      <router-view />
    </main>

    <!-- Footer -->
    <AppFooter />
  </div>
</template>

<script setup lang="ts">
import { onMounted } from 'vue'
import { useRouter } from 'vue-router'
import AppHeader from '@/components/Header/AppHeader.vue'
import AppFooter from '@/components/Footer/AppFooter.vue'

const router = useRouter()

// 检查用户认证状态
const checkAuth = () => {
  const token = localStorage.getItem('user_token')
  if (!token) {
    router.push('/auth/login')
    return false
  }
  return true
}

onMounted(() => {
  checkAuth()
})
</script>

<style scoped lang="scss">
.auth-layout {
  min-height: 100vh;
  background: #f8fafc;
  display: flex;
  flex-direction: column;

  .main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
  }
}
</style>